import pytest
import psycopg2

@pytest.fixture(scope="module")
def db_connection():
    conn = psycopg2.connect("dbname=test user=postgres")
    yield conn
    conn.close()

@pytest.fixture
def clean_users_table(db_connection):
    """每次测试后清空用户表"""
    cursor = db_connection.cursor()
    cursor.execute('')
    yield
    db_connection.rollback()